/*
 *  Created on: Apr 16, 2009
 *      Author: Ramesh Rajaby
 */

#ifndef _COMPOSER_SHARED_
#define _COMPOSER_SHARED_

#include <iostream>
#include <cstdlib>
#include <fstream>
#include <cstring>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <sstream>
#include <boost/tokenizer.hpp>
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/regex.hpp>

using namespace std;

typedef unsigned int uint;

typedef int StackPointer;
typedef short int OpCode;
typedef int Size;


//COMPILER OPTIONS
class CompilerOptions {
public:
	static string NOT_COMPILED_EXTENSION;
	static string COMPILED_EXTENSION;
	static const int START_CLASS_INDEX = 10;
};


//LANGUAGE KEYWORDS
class LanguageKeywords {
public:
	static string MEMBERS;
	static string METHODS;
	static string END_SCOPE;
	static string NEW;
	static string VARIABLE_TYPE;
	static string LOAD_EXTERNAL_CLASS;
	static string CLASS;

	static string RESERVED_VAR;
	static string SPECIAL_ASSIGNMENT;

	static string SL_COMMENT;

	static string PRIVATE;
	static string PUBLIC;
};

//BYTECODE KEYWORDS
class BytecodeKeywords {
public:
	static int NULL_;
};

class Types {
private:
	static Size SIZES[];
	static string KEYWORDS[];

	static const int POINTER_SIZE = 4;

public:
	static const int INT = 1;
	static const int LONG = 2;
	static const int FLOAT = 3;
	static const int DOUBLE = 4;
	static const int CHAR = 5;
	static const int STRING = 6;
	static const int POINTER = 7;

	static const int PRIMITIVES_NUMBER = 6;

	static const int NATIVES_NUMBER = PRIMITIVES_NUMBER + 2;

	static string POINTER_KEYWORD;

	static string getTypeKeyword(int typeId);
	static int getConstantType(string c);
	static int getSize(int typeId);
};

class LowLevelInstructions {
public:
	static string ASSIGN;
	static string ADD;
	static string ADD3;
	static string SUB;
	static string SUB3;
	static string MUL;
	static string MUL3;
	static string DIV;
	static string DIV3;
	static string MOD;
	static string MOD3;

	static string LESS;
	static string LESSEQ;
	static string EQUAL;
	static string UNEQUAL;

	static string JABS;
	static string JREL;

	static string JLESS;
	static string JLESSEQ;
	static string JEQUAL;
	static string JUNEQUAL;

	static string SCAN;
	static string PRINT;
	static string PRINTLN;

	static string ASSIGN_STACKTOHEAP;
	static string ADD_STACKTOHEAP;
	static string SUB_STACKTOHEAP;
	static string MUL_STACKTOHEAP;
	static string DIV_STACKTOHEAP;
	static string MOD_STACKTOHEAP;

	static string ASSIGN_HEAPTOSTACK;
	static string ADD_HEAPTOSTACK;
	static string SUB_HEAPTOSTACK;
	static string MUL_HEAPTOSTACK;
	static string DIV_HEAPTOSTACK;
	static string MOD_HEAPTOSTACK;
};


#include "AST/ParsingUtils.h"
#include "Bytecode/BytecodeUtils.h"
#include "FileWriter/FileWritingUtils.h"
#include <iosfwd>

#endif
